<?php
class State_model extends Model {
	function readAll() {
		$query = $this->db->get('states');
		return $query->result();
	}

	function read($id) {
		$query = $this->db->getwhere('states', array('id' => $id));
		return $query->row();
	}

	function create() {
		$data = array(
			'name' => $this->input->post('name')
		);
		$this->db->insert('states', $data);
	}

	function update($id) {
		$data = array(
			'name' => $this->input->post('name')
		);
		$this->db->update('states', $data, array('id' => $id));
	}
}
?>
